<template>
  <tr>
    <td><input type="checkbox" v-model="tObj.checked" /></td>
    <td>{{ tObj.name }}</td>
    <td>{{ tObj.price }}</td>
    <td>
      <button @click="desc">-</button>{{ tObj.num }}
      <button @click="add">+</button>
    </td>

    <td>{{ tObj.price * tObj.num }}</td>
    <td>
      <button @click="del">删除</button>
    </td>
  </tr>
</template>

<script>
export default {
  props: ["tObj", "index"],
  methods: {
    add() {
      this.tObj.num++;
    },
    desc() {
      this.tObj.num--;
    },
    del() {
      this.$emit("des", this.index);
    },
  },
};
</script>

<style></style>
